<%@ page contentType="text/html;charset=UTF-8" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>Events</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><g:link class="list" action="list">All Event List</g:link></span>
            <span class="menuButton"><g:link class="create" action="create">New Event</g:link></span>
            <span class="menuButton"><g:link controller="positione" action="list">Positions</g:link></span>
            <span class="menuButton"><g:link controller="user" action="logout">Logout</g:link></span>
            
        </div>

        <div class="body">
           <br>
            <g:if test="${flash.message}">
<div class="message">${flash.message}</div>
</g:if>
        <p>
Welcome to the signup application!
</p>
            <br>
            <h1>Future Events</h1>
            <br><br>
             <g:if test="${events.size() <1}">
        There are no future events
    </g:if>
<table>

    <g:each in="${events}" var="event">
        <tr>
            <td>${event.name}</td>
            <td>${event.description}</td>
            <td><g:formatDate format="MM/dd/yyyy" date="${event.date}" /></td>
            <td><g:link action="viewPositions" id="${event.id}">View Positions</g:link></td>
        </tr>
    </g:each>
</table>
        </div>
    </body>
</html>